package com.fc.h5dispaly.h5display.home;

import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.Window;

import com.fc.h5dispaly.h5display.home.v.HomeLayout;
import com.fc.h5dispaly.h5display.util.Util;


/**
 * Created by fc on 2018/8/6.
 */

public class HomeActivity extends Activity {
    private HomeLayout homeLayout;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        Util.instence(this);
        homeLayout = new HomeLayout(this);
        setContentView(homeLayout);

        Uri uri_user = Uri.parse("content://com.fc.h5dispaly.contentprovider/user");
        //插入数据
        ContentValues values = new ContentValues();
        values.put("_id","1");
        values.put("name","fc");
        //获取ContentResolver
        ContentResolver contentResolver = getContentResolver();
        contentResolver.insert(uri_user,values);

        Cursor cursor = contentResolver.query(uri_user,new String[]{"_id","name"},null,null,null);
        if (cursor != null) {
            while (cursor.moveToNext()){
                Log.i("contentProvider","第一列:"+cursor.getInt(0) +"  第二列:"+ cursor.getString(1));
            }
            cursor.close();
        }

    }
}
